Jx.declare('Jx.platform.browser.dom.DefaultView', {

	$extend: 'Jx.platform.browser.dom.Node',
	
	document: undefined,

	onInitialize: function(operation){
		
		var node = this.node;
		
		this.defaultView = this;
		
		this.$super(arguments);
		
		this.document = Jx.instantiate('Jx.platform.browser.dom.Document', [

			this,

			node.document,
			
			this.engine

		]);

		//-- create destructor
		this.on({

			'unload': this.handleDefaultViewUnload,

			scope: this

		});

	},

	onDestroy: function(){

		var doc = this.document(),

			engine = this.engine;

		if (doc){

			doc.destroy();

		}

		this.$super(arguments);

	},

	handleDefaultViewUnload: function(evt){

		this.destroy();

	},
	
	isValidNode: function(node){
		
		return this.$Dom.isView(node);
		
	}


});
